<link rel="stylesheet" type="text/css" href="<?= base_url() ?>file/js/easyui/themes/gray/easyui.css"> 
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>file/js/easyui/themes/icon.css">
<link rel="stylesheet" href="<?= base_url() ?>file/js/jquery-ui-1.8.17.custom/development-bundle/themes/ui-lightness/jquery.ui.all.css">

<h2>Upload Aplikasi Mobile</h2>

<?php if($error) { ?>
	<div class="error-box">
		<img src="<?=base_url()?>file/images/cross.png" alt="close" class="tutup"/>
		<?php echo $error; ?>
	</div>
<?php } ?>
<?php 
	echo form_open_multipart('index.php/upload/mobile/doupload', 'id="upload-mobile" '); 
    echo br();
    echo form_radio('app_type', 'mobile-android', TRUE, 'id="app_type"');
	echo form_label('Android', 'android');
	echo form_radio('app_type', 'mobile-bb', FALSE , 'id="app_type"');
	echo form_label('Blackberry', 'blackberry');
    echo form_radio('app_type', 'mobile-wp',FALSE , 'id="app_type"');
	echo form_label('Windows Phone', 'windows phone');
    echo br();
    echo form_hidden('territory_id','1');
    echo form_label('Dari : ','from');
    echo "<input type='text' id='apply_date' name='apply_date' class='medium' />
		<a><img id='apply_date_image' height='20px' style='margin-left:1%;' src='".base_url()."file/js/easyui/themes/default/images/datebox_arrow.png' /></a>";
    echo form_label('Sampai : ','to');
    echo "<input type='text' id='expired_date' name='expired_date' class='medium' />
		<a><img id='expired_date_image' height='20px' style='margin-left:1%;' src='".base_url()."file/js/easyui/themes/default/images/datebox_arrow.png' /></a>";
    echo br(2);
    $param = 'id="regions" onChange="feed_cluster();"';
   /**
 *  echo form_label('Region','regionlbl'); echo form_dropdown('region', $region,'null',$param);echo br();
 *     echo form_label('Cluster','clusterlbl'); echo form_dropdown('cluster', $cluster,'null');echo br();
 */
    echo form_label('Versi','versionlbl'); echo form_input('app_version');echo br();
	 echo form_label('Aplikasi','applicationlbl');echo form_upload('mobile', '', 'id="file-name"');
    echo br();
?>
</p>
<hr/>
<div id="f1_upload_process">
      <p>Please, be patient while your data being insert into database
      <p id="progressbar"></p>
</div>
<?php 
	echo form_submit('', 'Upload', 'id="execute" onClick="startUpload()"');
	echo form_reset('', 'Cancel', 'id="cancel"');
?>
<?php echo form_close(); ?>


<script type="text/javascript">


function feed_cluster(){
    alert ($('#regions').val());
}

$(document).ready(function(){

      $('#progressbar').hide();
      $('#f1_upload_process').dialog({ 
            dialogClass: "alert" ,
            height: '100',
            draggable: false,
            modal: true,
            resizable: false,
            autoOpen: false
      });
      $( "#progressbar" ).progressbar({value: 100});
      $('.tutup').click(function(){
            $('.error-box').hide('slow');
      });
});
	$(function() {
		$( "#apply_date" ).datepick({
			yearRange: '1950:2050'
		});
		
		$("#apply_date_image").click(function(){
			$("#apply_date").datepick("show");
		});	
	});
    
    $(function() {
		$( "#expired_date" ).datepick({
			yearRange: '1950:2050'
		});
		
		$("#expired_date_image").click(function(){
			$("#expired_date").datepick("show");
		});	
	});
    
function startUpload(){
      $('.error-box').hide('slow');
      $('#f1_upload_process').dialog('open');
      $('#progressbar').show();
      return true;
}
</script>
